-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Modbus Sunspec compatibility to opendtu-onbattery #1150
base: development
Are you sure you want to change the base?
Conversation
This reverts commit 5617240ce1fb15a3796d1ed558cc89f9ba72d8d5.
… "Total Power" and "Total Yield" into registers.
merge 23.6.26
prevent sending 0 as "e_energy_exported" to avoid peaks and gaps in solarweb statistic
merge v23.6.28
merge v23.8.3
thanks for your effort. another thing, it would be good, if your changes would be based on helgeerbe:development or :master, too. right now, your changes are based on a fork of the upstream project, which makes it difficult to compare or include as there may be many more changes than you actually want to add. On the other hand, it is now only "+278/-3", which is much less than the previous "+3,652/-2,191". So I think the developer can work with that. |
merge v24.8.5
I am sorry for the confusion In a yet (in my repository) not commited change I created configuration for the necessary sunspec fields so it may be compatible with other inverters which do the same. I will update this PR as soon as I have tested all the changes well enough. |
add configuration for elements to equip with custom vendor strings.
There are still a lot of unrelated changes, please make sure that you base your branch off of the OpenDTU-OnBattery development branch.
Please do not commit any file within |
@@ -76,6 +76,16 @@ struct CONFIG_T { | |||
bool Enabled; | |||
} Mdns; | |||
|
|||
struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add bool verboseLogging
to your struct and use that to enable/disable logging within your Modbus module instead of commenting the logging lines.
@@ -45,6 +45,7 @@ lib_deps = | |||
nrf24/RF24 @ 1.4.9 | |||
olikraus/U8g2 @ 2.35.19 | |||
buelowp/sunset @ 1.1.7 | |||
https://github.com/emelianov/modbus-esp8266#master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we point to a specific commit or release-tag instead of a branch?
This might break builds at any point in the future without us knowing whats going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently not, as there is a change which is most probably needed in master only:
emelianov/modbus-esp8266#292
as soon as there is a 4.1.2 (or whatever) released I think this one could be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you specific the commit hash with #a5872af7250e03e9a5cd578366b0c2cdc097fcc9
instead of #master
you can make sure that the dependency won't get updated randomly with the next push to master
// mb.Hreg(0x9cbb, 0); | ||
// mb.Hreg(0x9cbc, 0); | ||
// mb.Hreg(0x9cbd, 0); | ||
// mb.Hreg(0x9cbe, 0); | ||
// mb.Hreg(0x9cbf, 0); | ||
// mb.Hreg(0x9cc0, 0); | ||
// value = (inv->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_YT)*1000); //done above already! | ||
// if (value > _lasttotal) { | ||
// _lasttotal = value; | ||
// mb.Hreg(0x9cc1, hexbytes[1]); //done above already! | ||
// mb.Hreg(0x9cc2, hexbytes[0]); //done above already! | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented lines if they are not needed
|
||
ModbusDtuClass ModbusDtu; | ||
|
||
ModbusDtuClass::ModbusDtuClass() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense if we call it ModbusSunspec
or SunspecModbus
to explain what this is actually doing?
Do you have any documentation about the protocol that youa re implementing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this implementation is (maybe only partially) modbus-sunspec compatibility to simulate a sunspec energy-meter.
as far as I could google, this should match to "sunspec meter" registers in float mode.
I could not check if it is the complete protocol or only partial.
at least, if I check against fronius documentation, it is complete.
91cc2fc
to
8ff94e7
Compare
This pull-request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@AndreasBoehm @schlimmchen @stefan123t I am not sure when I find time to do the changes requested above. my issue is, that adapting / merging to current OpenDTU versions (or also OpenDTU-OnBattery) is very time consuming caused by my knowledge. it looks like there are some enhancement requests regarding ModbusTCP, I am happy if I can help, but I maybe need your help too if it is really wanted to be merged. Thanks. Best regards |
mb.Hreg(0x9cc2, hexbytes[0]); | ||
} | ||
|
||
if (Hoymiles.getNumInverters() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if a user has configured multiple inverters?
Now that the DPL supports multiple inverters we shall not limit this feature a single inverter only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with multiple inverters the modbus data for total power (40097 and 40098) and yieldtotal (40129 and 40130) is filled.
those two values are the important one which are accumulateable easily (like already done in the "Total Yield Total" and "Total Power" in webgui)
other data (like frequency, voltage, etc.) is not filled, as we do not know from which source to take, and accumulating / calculating averages makes no sense at all.
this data is not mandatory (at least not for fronius inverters) to accept the ModbusTCP as smartmeter.
Let's talk about more about what this PR or your feature actually does, at least how i understood it. Please correct me if any of my assumptions are wrong.
Changes that i would suggest
I am wondering if this would be something that should be in the upstream project as its not related to having a battery at all? |
exactly.
I copied existing elements with great difficulty to have the here available settings. I am sure I cannot manage to create its own page renaming I can do, only the here mentioned? #1150 (comment) code cleanup I think I can not do satisfying enough. I tried to make the code already best readable as possible for me. the sunspec protocol documentation looks to be liable to pay costs: https://sunspec.org/sunspec-modbus-specifications/
there a previous modbus implementation was asked to offer a PR here. |
@AloisKlingler there are three compatibel standards mentioned on the sunspec page you referred to:
I have been able to download the IEEE_1547-2018_SunSpec.pdf PDF specifications for Distributed Energy Resource (DER) interoperability using the protocols defined in IEEE 2030.5-2018, IEEE 1815-2012 and SunSpec ModBus over TCP/IP transport via Ethernet / RS-485 (only the latter) from the above site. The other two are behind a paywall, access to which might be available to scientific researchers. I agree with you all that it would be worthwhile to include this in the upstream project as it enables a standard ModBus interface besides MQTT and Web API to share data from the Hoymiles DTUs in the OpenDTU project. I hope this may be (re-)considered at a later stage, once the PR has been more refined to both projects coding standards. |
this implementation is (maybe only partially) modbus-sunspec compatibility to simulate a sunspec energy-meter.
to have calculation (especially self-consumption) correct for e.g. fronius solar web you need to either place a 300€ fronius smart meter before each "foreign" inverter.
With this PR it is possible to configure OpenDTU with it's IP-address as a "Smartmeter" on Fronius Gen24 or Fronius Symo inverter. so the Fronius Inverter is able to poll current production and overall production continuously like a from a real fronius-smartmeter.
necessary configuration on OpenDTU:
![image](https://private-user-images.githubusercontent.com/11095760/355742602-3d7b601d-9cb1-42c9-8ab7-2210ae29206b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MTgsIm5iZiI6MTczODk2NTQxOCwicGF0aCI6Ii8xMTA5NTc2MC8zNTU3NDI2MDItM2Q3YjYwMWQtOWNiMS00MmM5LThhYjctMjIxMGFlMjkyMDZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIxNTY1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjYTBjM2FkOGQ3YjEzMTQ3ZjU3OGY1N2I3MDFjZTAxMjY0NDQ5MDdlMGQ0YWEwYmVhYmE0NjkyZDM3MjJmYzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.UAnuOK2QoMSpELICHUGyGmDFSMcqsJOfA6zXVgyn5Jk)
configuration on an Gen24 Inverter:
![image](https://private-user-images.githubusercontent.com/11095760/354803548-669f9f3a-50c9-4c5f-a229-aa945b63c72c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MTgsIm5iZiI6MTczODk2NTQxOCwicGF0aCI6Ii8xMTA5NTc2MC8zNTQ4MDM1NDgtNjY5ZjlmM2EtNTBjOS00YzVmLWEyMjktYWE5NDViNjNjNzJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIxNTY1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3OTRiMmZlZDQ2YTFhYWUzM2Q3ODkyNTNhYzgwYmY0ZGJjOGZmYzJhYzE0ZWRjOTI1MGU1NWI1NzYyMDRkOGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.F-JMrxMgQs25WAgRFK6gMQ_9HpAqMz_kH-0Ur0LZ_Mo)
visualisation on an Gen24 inverter:
![image](https://private-user-images.githubusercontent.com/11095760/354803717-1945a61b-fec7-4fa4-9a4e-19d0cdb30f54.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MTgsIm5iZiI6MTczODk2NTQxOCwicGF0aCI6Ii8xMTA5NTc2MC8zNTQ4MDM3MTctMTk0NWE2MWItZmVjNy00ZmE0LTlhNGUtMTlkMGNkYjMwZjU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIxNTY1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFlNjhiZTM1NWY4MjI4Njc4ZDkwNWQyNWU1YzYyYzU5NTk2ZDYwNDNlOWZlYzliZmE1ZjNhMTIwYTZjMTZkMTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cGA3rxxZ_jJ0zFQ9bsrY0ZPpkXc1fi4df4ICGQINdFY)
visualisation of the additional "Smartmeter" in Fronius Solarweb as "Additional AC Source":
![image](https://private-user-images.githubusercontent.com/11095760/354803767-122e5b52-8d8d-4d91-957e-dd5d4340f942.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MTgsIm5iZiI6MTczODk2NTQxOCwicGF0aCI6Ii8xMTA5NTc2MC8zNTQ4MDM3NjctMTIyZTViNTItOGQ4ZC00ZDkxLTk1N2UtZGQ1ZDQzNDBmOTQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIxNTY1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ0ZWFkYTBmMDViYTZmMzgyYWY0NzE5ZTllMjkxMTQ2MGYwZDIxZDE4ZGVkNjkxODk3NWYzYmJkYzA3OWVlMGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.EQZZ90bFYDyfa5Sz0oTwRFYLJ6mFn8CUqm5xm4OpBoM)
visualisation of the "Smartmeter" data in Solarweb is available as common curve like other inverters are:
![image](https://private-user-images.githubusercontent.com/11095760/354803849-0070c442-d9bb-465a-95cc-5a4b8a5f25e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MTgsIm5iZiI6MTczODk2NTQxOCwicGF0aCI6Ii8xMTA5NTc2MC8zNTQ4MDM4NDktMDA3MGM0NDItZDliYi00NjVhLTk1Y2MtNWE0YjhhNWYyNWU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIxNTY1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmNjhjZTUzMGNkNTdmYWE2NTA3MzA3YTExYjA3YjhkZjU4ZjRkNzE1NjMxODg0OTRlY2M4NTQyYTc4MGQ2N2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.EMHSDvNOij9LtcewSkkdxsMxmUVSqqPCyvgn-0dDAP8)
for my OpenDTU (and also some other users of photovoltaikforum.com) this implementation is running now over a year (more or less) flawless.
to the PR: the tree conflicting files webapp_dist/* need to be resolved on merge. other conflicts I could solve.